module TargetSystemCheck
  class << self
    def windows?
      not recipe_disables_windows? stage_file
    end

    # @return current stage name
    def stage_argument
      ARGV.first
    end

    # @return [File] the stage configuration file
    def stage_file
      File.open "config/deploy/#{stage_argument}.rb"
    end

    def recipe_disables_windows?(file)
      file.to_a.grep(/^\s*not_windows!(\(\s*\))?\s*(#.*)?$/).any?
    end
  end
end
